package com.bw.liveplay.common.mvvm.mondel

import com.bw.liveplay.common.entity.BaseEntity
import com.bw.liveplay.common.network.ChanageObservable
import com.google.gson.Gson
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody

/**
 * @author KK
 * @description:
 * @date :2021/11/9 18:38
 *
 */
abstract class BaseModel : IModel{
    override fun createBody(map: HashMap<String, Any>): RequestBody {
        return RequestBody.create(MediaType.parse("application/json"),Gson().toJson(map))
    }

    override fun changeFun(observable: Observable<*>): Observable<BaseEntity> {
        return observable.map(ChanageObservable())
    }

}